
#include <ramps.h>
#include <tempControl.h>



#include <OneWire.h>

#include <DallasTemperature.h>

// include the library code:
#include <LiquidCrystal.h>

// Temp Data wire is plugged into pin 10 on the Arduino
#define ONE_WIRE_BUS 2

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// Assign the addresses of your 1-Wire temp sensors
uint8_t insideThermometer[8] = { 0x28, 0xF4, 0x5D, 0x09, 0x04, 0x00, 0x00, 0xC4 };

TempControl luisehviado(ONE_WIRE_BUS, insideThermometer);
unsigned long time;

void setup(void) {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Temperatura:");
  luisehviado.AddRamp(25.0, 29.7, 30.0);
  luisehviado.AddRamp(30.0, 31.0, 30.0);
  luisehviado.AddRamp(32.0, 32.0, 30.0);

  // Setup tempcontrol object
  luisehviado.Setup();
}
 
void loop(void) {

  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  time = millis();
  Serial.print("Tempo: ");
  Serial.print(time/1000);
  Serial.print("\n");
  char rise = luisehviado.Control((float)time/1000);
  luisehviado.SerialPrint();
  if(rise == 1) Serial.print("\tAumenta\n");
  if(rise == 0) Serial.print("\tDiminui\n");
  if(rise == -1) Serial.print("\tAcabou");
}
